package cn.itcast.common.controller;

import cn.itcast.common.config.ComoonConfiguration;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@Slf4j  //打日志引入log
public class TestController {
    //获取配置文件
    @Autowired
    private ComoonConfiguration comoonConfiguration;
    @GetMapping("query/{orderId}")
    public String  queryOrderByUserId(@PathVariable("orderId") Long orderId) {
        // 根据id查询订单并返回
        return "common获取成功";
    }

    @RequestMapping("query2/{orderId}")
    public String  queryOrderByUserId2(@PathVariable("orderId") Long orderId) {
        System.out.println("获取comoon本地配置：" + comoonConfiguration.getMyName()+comoonConfiguration.getMyAge()+comoonConfiguration.getMySchool());
        log.info("获取comoon本地配置日志：" + comoonConfiguration.getMyName()+comoonConfiguration.getMyAge()+comoonConfiguration.getMySchool());
        return "common获取成功";
    }
}
